import fs from 'fs'

export default class Config {

  constructor(){
    this.filePath = './config.json';
  }

  load(){
    let config;
    if(fs.existsSync(this.filePath)){
      config = JSON.parse(fs.readFileSync(this.filePath));
    }

    return config || {};
  }

  save(data){
    const info = Object.assign(this.load() || {},data);
    fs.writeFileSync(this.filePath,JSON.stringify(info));
  }
}
